package MeteoCal.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @authors Guttadoro, Iommazzo, Saullo
 */
@Embeddable
public class ReceivednotificationPK implements Serializable {
    @Basic(optional = false)
    @Column(name = "idNotification")
    private int idNotification;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "idUser")
    private String idUser;

    public ReceivednotificationPK() {
    }

    public ReceivednotificationPK(String idUser, int idNotification) {
        this.idUser = idUser;
        this.idNotification = idNotification;
    }

    public int getIdNotification() {
        return idNotification;
    }

    public void setIdNotification(int idNotification) {
        this.idNotification = idNotification;
    }

    public String getIdUser() {
        return idUser;
    }

    public void setIdUser(String idUser) {
        this.idUser = idUser;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) idNotification;
        hash += (idUser != null ? idUser.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ReceivednotificationPK)) {
            return false;
        }
        ReceivednotificationPK other = (ReceivednotificationPK) object;
        if (this.idNotification != other.idNotification) {
            return false;
        }
        if ((this.idUser == null && other.idUser != null) || (this.idUser != null && !this.idUser.equals(other.idUser))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "MeteoCal.entity.ReceivednotificationPK[ idNotification=" + idNotification + ", idUser=" + idUser + " ]";
    }
    
}
